from zope.interface import implements, Interface

from Products.Five import BrowserView
from Products.CMFCore.utils import getToolByName
from my315ok.xtjxwcontents.browser.jiaxiaoview import jiaxiaoView

from my315ok.xtjxwcontents import xtjxwcontentsMessageFactory as _


class IjiaolianView(Interface):
    """
    jiaolian view interface
    """

    def test():
        """ test method"""


class jiaolianView(jiaxiaoView):
    """
    jiaolian browser view
    """
    implements(IjiaolianView)

    
    def fetchimage(self,scale='thumb'):
        sc = self.context.absolute_url() + '/image_' + scale 
        alt = self.context.Title()
        html='<img src="%s" alt="%s" />' % (sc,alt)
        return html
    def parentname(self):
        parent = self.context.aq_inner.aq_parent
        name = parent.getName()        
        return name
    
    def test(self,a,b,c):
        if a:
            return b
        else:
            return c
